package com.study.创造型模式.工厂模式.简单工厂模式.改进;

//简单工厂类
public class SimpleFactory {

    //根据orderType返回对应的pizza对象
    public static Pizza createPizza(String orderType){
        System.out.println("使用简单工厂模式");
        Pizza pizza =null;
            if (orderType.equals("greek")){
                pizza = new GreekPizza();
                pizza.setName("希腊披萨");
            }else if (orderType.equals("cheese")){
                pizza =new CheesePizza();
                pizza.setName("奶酪披萨");
            }else if (orderType.equals("pepper")){
                pizza = new PepperPizza();
                pizza.setName("胡椒披萨");
            }

            return pizza;
    }
}
